#!/bin/sh
set -xeuo pipefail

docker images|grep "tca-client"

#ISSUE 1
# /opt/client/node/gitload.py https://github.com/TCATools/linux-scc.git/ scm_url.replace("github.com","hub.fastgit.org")
#三方检查工具统一安装在 /opt/client/data/tools 目录下

#ISSUE 2
：<<EOF
https://hub.fastgit.org/Tencent/CodeAnalysis/issues/42
https://hub.fastgit.org/Tencent/CodeAnalysis/issues/60 github每次分析的连接问题

# ls
cloc                            common-lizard-1.17.5   linux-Python-v3.7.2    linux-scc
common-cobra-v2.0.0-alpha.5     common-pmd-bin-5.8.1   linux-dart-sdk-v2.7.2  puppy-tools-config
common-dart-code-metrics-1.7.1  common-pmd-bin-6.19.0  linux-jdk1.8.0_65
common-detekt-cli-1.7.1-all     linux-Python-v2.7.13   linux-node-v12.16.3

cobra不可用，建议客户使用data/tools/cobra-v2.0.0-alpha.5/install.sh脚本进行安装
/opt/client/data/tools/common-cobra-v2.0.0-alpha.5/cobra.py --help
apt-get install -y flex bison phantomjs

cd /opt/client; tar czvf datatool.tar.gz ./data
EOF

docker run -itd -v ./pkg:/opt/pkg --name tca-client --network host tca-client:2022
# docker run -it --name tca-client --network host tca-client:2022 sh
sleep 3

docker cp ./client/node/gitload.py tca-client:/opt/client/node/gitload.py
docker exec -it tca-client sh -c "
cd /opt/pkg; tar xvzf ./datatool.tar.gz -C /opt/client/
cd /opt/client/; python3 codepuppy.py localscan"

